//
//  Utility.h
//  CloudTravel
//
//  Created by hetao on 10-12-5.
//  Copyright 2010 oulin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SVProgressHUD.h"

//#define showProgressIndicator_width 250

#define Lang(en,zh) ([Utility defaultsForKey:@"zh"]?zh:en)
@interface Utility : NSObject

@property (nonatomic,strong) NSDictionary *userInfo;
@property (nonatomic,assign) BOOL userMaster;

+(id)Share;
+ (void)alertError:(NSString*)content;
+ (void)alertSuccess:(NSString*)content;
- (void)alert:(NSString*)content;
- (void)alertContentCancel:(NSString*)content delegate:(id)delegate;
- (void)alert:(NSString*)content delegate:(id)delegate;
- (void)alert:(NSString*)content delegate:(id)delegate buttons:(NSArray*)buttons;
- (void)alert:(NSString*)content delegate:(id)delegate buttons:(NSArray*)buttons tag:(NSInteger)tag;

+ (NSString *)timeInBeijing;
- (NSString *)timeToNow:(NSString*)theDate;
+ (NSString *)convertDateToLocalTime: (NSString *)forDate;

+ (BOOL) validateEmail: (NSString *) candidate ;
+ (BOOL) validateTel: (NSString *) candidate ;
+ (BOOL)validateMac:(NSString*) candidate;
+ (BOOL)validateUUID:(NSString*) candidate;
- (void) makeCall:(NSString *)phoneNumber;

+ (BOOL)removeForArrayObj:(id)obj forKey:(NSString*)key;
+ (void)saveToDefaults:(id)obj forKey:(NSString*)key;
+ (void)saveToArrayDefaults:(id)obj forKey:(NSString*)key;
+ (void)saveToArrayDefaults:(id)obj replace:(id)oldobj forKey:(NSString*)key;

+ (id)defaultsForKey:(NSString*)key;
+ (void)removeForKey:(NSString*)key;

+(id)PostData:(NSDictionary*)dict forUrl:(NSString*)urlString;
+(id)PostImageData:(NSDictionary*)params forUrl:(NSString*)url;

@end
